import Taro, {  getUserProfile, } from '@tarojs/taro'
import { View, Button } from '@tarojs/components'
import React, {useEffect, useState} from 'react'

function Index () {
  // useInfo存储用户的信息
  const [useInfo, setUseInfo] = useState({})
  // 用户信息的获取
  const handleGetUserProfile = () => {
    getUserProfile({
      lang: 'zh_CN',
      desc: '用于用户的考试测试信息',
      success: response => {
        setUseInfo(response.userInfo)
        console.log(response)
      },
      fail: () => {
        // 拒绝授权
        console.error('您拒绝了请求')
      }
    })
  }
  return (
    <View className="container" > 
      <Button type="primary" onClick={handleGetUserProfile}>登录</Button>
    </View>
  )
  
}

export default Index
